<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json</title>
    <script type="text/javascript">
        var user = {
            name:"今天",
            age:18,
            sex:"男"
        };
        // alert(user.name);
        console.log(user)

        //js对象-》json字符串
        var json = JSON.stringify(user);
        console.log(json)

        //json字符串-》js对象
        var obj = JSON.parse(json)
        console.log(obj)

    </script>
</head>
<body>
</body>
</html>
